package com.caigou.modules.data.network.api

import com.caigou.comm.base.bean.CommentBean
import com.caigou.comm.base.bean.CommentItemBean
import com.caigou.comm.base.bean.HttpResult
import com.caigou.modules.data.bean.*
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author #Suyghur.
 * Created on 2021/09/26
 */
interface HttpDataApiService {

    @GET("/api/meiqi/data/category/list")
    fun getDataTypeList(): Flow<HttpResult<MutableList<DataTypeItemBean>>>

    @GET("/api/meiqi/data/list")
    fun getDataList(@Query("categoryId") categoryId: Int): Flow<HttpResult<MutableList<DataItemBean>>>

    @GET("/api/meiqi/data/formula/list")
    fun getLawList(): Flow<HttpResult<MutableList<LawItemBean>>>

    @GET("/api/meiqi/data/quannian/list")
    fun getAllYearList(): Flow<HttpResult<MutableList<AllYearItemBean>>>

    @GET("/api/meiqi/data/details")
    fun getDataDetail(
        @Query("categoryId") categoryId: Int,
        @Query("mysteryId") mysteryId: Int,
        @Query("userId") userId: String
    ): Flow<HttpResult<DataDetailBean>>

    @GET("/api/meiqi/data/formula/details")
    fun getLawDetail(@Query("formulaId") formulaId: Int, @Query("userId") userId: String): Flow<HttpResult<LawDetailBean>>

    @GET("/api/meiqi/data/quannian/details")
    fun getAllYearDetail(@Query("mysteryId") mysteryId: Int, @Query("userId") userId: String): Flow<HttpResult<ALlYearDetailBean>>

    @GET("/api/meiqi/data/reply/list")
    fun getCommentList(
        @Query("page") page: Int,
        @Query("limit") limit: Int,
        @Query("dataId") dataId: Int,
        @Query("type") type: Int,
        @Query("sort") sort: Int,
        @Query("currentUserId") currentUserId: String
    ): Flow<HttpResult<CommentBean>>

    @GET("/api/meiqi/data/reply/details")
    fun getCommentDetail(
        @Query("dataId") dataId: Int,
        @Query("replyId") replyId: Int,
        @Query("userId") userId: String,
        @Query("type") type: Int
    ): Flow<HttpResult<CommentItemBean>>

    @POST("/api/meiqi/data/reply")
    fun setReply(@Body body: RequestBody): Flow<HttpResult<String>>

    @POST("/api/meiqi/data/like")
    fun setDataLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/meiqi/data/reply/like")
    fun setCommentLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

}